home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / PRG / KeyboardState 1.0 folder.sit / KeyboardState 1.0 folder / Comments about KeyboardState 1.
Text File  |  1996-05-15  |  812b  |  1 lines

  1. KeyboardState 1.0 - This program was born out of necessity. I was working on a project and needed to know if the command key was down, but didnユt know how to find out. After a quick look at Inside Mac (Inside Macintosh: Macintosh Toolbox Essentials, pg. 2-110 if you want more info), I found that the function GetKeys would allow me to do that. Normally you only get a keypress through keyDown events, but you can also see which keys are pressed at any time by calling the function GetKeys. GetKeys returns a map of the keyboard. A KeyMap is declared (in メEvents.hモ) as an array of 4 long ints, so itユs 128 bits in all. Each key on the keyboard has a corresponding bit in the map. The bit is 1 in the key is down, 0 if itユs up. A maximum of two keys and any combination of the modifiers can be down at one time.